package it.uniroma2.art.owlart.langsearch.index.struct;

import java.util.Collection;
import java.util.HashMap;

public abstract class DualKeyMap<K1, K2, V> {

	HashMap<String, V> innerMap;
	
	DualKeyMap() {
		innerMap = new HashMap<String, V>();
	}
	
	public void clear() {
		innerMap.clear();
	}

	public Object clone() {
		return innerMap.clone();
	}
	
	public boolean containsKey(K1 key1, K2 key2) {
		return innerMap.containsKey(mergeKeys(key1, key2));
	}

	public boolean containsValue(V value) {
		return innerMap.containsValue(value);
	}

	public boolean equals(Object o) {
		return innerMap.equals(o);
	}
	
	public V get(K1 key1, K2 key2) {
		return innerMap.get(mergeKeys(key1, key2));
	}

	public int hashCode() {
		return innerMap.hashCode();
	}

	public boolean isEmpty() {
		return innerMap.isEmpty();
	}
	
	public V put(K1 key1, K2 key2, V value) {
		return innerMap.put(mergeKeys(key1, key2), value);
	}
	
	public V remove(K1 key1, K2 key2) {
		return innerMap.remove(mergeKeys(key1, key2));
	}

	public int size() {
		return innerMap.size();
	}

	public String toString() {
		return innerMap.toString();
	}

	public Collection<V> values() {
		return innerMap.values();
	}

	public abstract String mergeKeys(K1 key1, K2 key2);
	
}
